<ui:composition template="/admin/templates/ui2.xhtml"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:composite="http://java.sun.com/jsf/composite/primefaces"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:fn="http://java.sun.com/jsp/jstl/functions"
    xmlns:c="http://java.sun.com/jsp/jstl/core">
    <f:metadata>
        <f:viewParam name="id" value="#{permissionHome.id}"></f:viewParam>
    </f:metadata>

    <ui:define name="content">
		 <div class="entry">
		 <p:toolbar styleClass="admin-nav-toolbar">
            <p:toolbarGroup>
                <h:outputLabel value="#{commonMsg.currentPositionLabel} #{userMsg.permissionEditLabel}"></h:outputLabel>
            </p:toolbarGroup>
            <p:toolbarGroup align="right">
                <p:separator />
                <p:button value="#{userMsg.permissionManagerLabel}" outcome="/admin/user/permissionList"></p:button>
            </p:toolbarGroup>
        </p:toolbar>
        <p:spacer></p:spacer> 
            <h:form id="form">
                <h:panelGrid columns="2"  columnClasses="col1,col2" id="panel">
                    <h:outputLabel value="#{commonMsg.IDLabel}"></h:outputLabel>
                    <h:inputText value="#{permissionHome.instance.id}" readonly="#{not empty permissionHome.id}"
                        required="true" label="#{commonMsg.IDLabel}" requiredMessage="#{commonMsg.IdRequired}"></h:inputText>
                    
                    <h:outputLabel value="#{commonMsg.nameLabel}"></h:outputLabel>
                    <h:inputText id="name" required="true" label="#{commonMsg.nameLabel}"
                        value="#{permissionHome.instance.name}" requiredMessage="#{commonMsg.NameRequired}">
                        <f:validateLength minimum="2"></f:validateLength>
                    </h:inputText>
                    
                    <h:outputLabel value="#{commonMsg.descriptionLabel}"></h:outputLabel>
                    <h:inputTextarea value="#{permissionHome.instance.description}" style="width:600px;height:60px;"></h:inputTextarea>
                    
                    <h:outputLabel value="#{commonMsg.actionLabel}"></h:outputLabel>
                    <ui:fragment>
                        <p:commandButton action="#{permissionHome.save}" update="@form" 
                            value="#{commonMsg.saveLabel}" id="saveBtn"></p:commandButton>
                        <p:commandButton type="reset" value="#{commonMsg.resetLabel}"></p:commandButton>
                        <p:blockUI block="panel" trigger="saveBtn"></p:blockUI>
                    </ui:fragment>
                    
                </h:panelGrid>
            
            </h:form>
          </div>
        </ui:define>
</ui:composition>

